<div class="user-r-title clearfix">
    <div class="common-title f-l">
        <a href="javascript:void(0)" class="field">{$data.page_title}</a>
    </div>
</div>
<div class="user-r-content clearfix">
    <form class="form-horizontal" ms-important="vm-form">
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">名称</label>
            <div class="col-sm-10">
                <input type="text" name="name" class="form-control" ms-duplex="@form_data.name" value="{$data.role_info.name}" id="name" placeholder="请输入权限名称">
            </div>
        </div>
        <div class="form-group">
            <label for="is_effect" class="col-sm-2 control-label">状态</label>
            <div class="col-sm-10">
                <label class="radio-inline">
                    <input type="radio" ms-duplex="@form_data.is_effect" name="is_effect" id="is_effect" {if $data.role_info.is_effect eq 1}checked{/if} value="1"> 有效
                </label>
                <label class="radio-inline">
                    <input type="radio" ms-duplex="@form_data.is_effect" name="is_effect" id="is_effect" {if $data.role_info.is_effect eq 0}checked{/if} value="0"> 无效
                </label>
            </div>
        </div>
        {foreach from="$data.role_list" item="role_list"}
        <div class="form-group">
            <label for="role_access" class="col-sm-2 control-label">{$role_list.cate_name}</label>
            <div class="col-sm-10">
                {foreach from="$role_list.role_list" item="item"}
                <label class="checkbox-inline">
                    <input type="checkbox" name="role_access" {if $item.node_auth eq 1}checked{/if} id="role_access" value="{$item.id}"> {$item.name}
                </label>
                {/foreach}
            </div>
        </div>
        {/foreach}
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <a href="javascript:void(0)" class="btn btn-primary mr-10" ms-click="submit">新增</a>
                <a href="javascript:history.back(-1)" class="btn btn-default">取消</a>
            </div>
        </div>
    </form>
</div>
<script>
    var role_access = [], is_effect = '{$data.role_info.is_effect}', name = '{$data.role_info.name}', role_list = <?php echo json_encode($this->_var['data']['role_list']);?>;
    for(var i=0; i<role_list.length; i++){
        for(var j=0; j<role_list[i].role_list.length; j++){
            if(role_list[i].role_list[j].node_auth == 1){
                role_access.push(role_list[i].role_list[j].id);
            }
        }
    }
</script>